package com.zgroup.controllers.admin

import com.zgroup.domain.SysUser;

class AdminDispatchController {

  def auth() {
    if ("forwardURL" == actionName) {
      return true
    }
    def user = SysUserController.getUserInfo(request)
    if (!user) {
      forward(action: "forwardURL")
      return false
    }
    request[SysUser.REQUEST_USER_INFO] = user
    return true
  }

  def forwardURL = {
    def url = grailsApplication.config.grails.serverURL + "/login"
    if (params.url) {
      url = params.url
    }
    render(view: "/forwardURL", model: [url: url])
  }

  def transData(srcMap, dstMap) {
    srcMap.each {
      dstMap[it.key] = it.value
    }
  }
}
